import type * as T from './type'
import http from '@/utils/http'
import type { LabelValueState } from '@/types/global'
// @ts-ignore
export type * from "./type";
const BASE_URL = '/business/educationUnit'
/** @desc 查询單元列表 */
export function listUnit(query: T.UnitQuery) {
  return http.get<PageRes<T.UnitPageQuery[]>>(`${BASE_URL}/page`, query)
}

export function unitLists() {
  return http.get<T.EducationUnitDto[]>(`${BASE_URL}/list`)
}

export function units() {
  return http.get<LabelValueState[]>(`${BASE_URL}/selectList`)
}

/** @desc 查询單元详情 */
export function getUnit(id: string) {
  return http.get<T.EducationUnitDto>(`${BASE_URL}/getData/${id}`)
}
/** @desc 獲取簽名 */
export function getSignatureData() {
  return http.get<any>(`${BASE_URL}/getSignature`)
}



/** @desc 新增單元 */
export function addUnit(data: any) {
  return http.post(`${BASE_URL}/create`, data)
}

/** @desc 修改單元 */
export function updateUnit(data: any) {
  return http.post(`${BASE_URL}/modify`, data)
}

/** @desc 删除單元 */
export function deleteUnit(ids: string | Array<string>) {
  return http.del(`${BASE_URL}/delete/${ids}`)
}


/** @desc 刷新緩存 */
export function refreshCache() {
  return http.get(`${BASE_URL}/refreshCache`)
}
